package Database;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.widget.Toast;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import barcode.code.nhat.iuhbarcode.R;

public class Dialogtoshow {

    public Activity acty;

    private String title, mess;
    private String cat;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getMess() {
        return mess;
    }

    public void setMess(String mess) {
        this.mess = mess;
    }

    public String getCat() {
        return cat;
    }


    public Dialogtoshow(Activity acty, String title, String mess, String cat) {
        super();
        this.acty = acty;
        this.title = title;
        this.mess = mess;
        this.cat = cat;
    }

    public Dialogtoshow() {
    }

    public void showdialognow1() {
        AlertDialog.Builder dialogbuider = new AlertDialog.Builder(acty);
        dialogbuider.setTitle("Error");
        dialogbuider.setMessage("Miss something!");
        dialogbuider.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(acty.getApplication(), "Please check box!", Toast.LENGTH_SHORT).show();
            }
        });
        AlertDialog ald = dialogbuider.create();
        ald.show();
    }

    public void showdialognow2() {
        AlertDialog.Builder dialogb = new AlertDialog.Builder(acty);
        dialogb.setTitle(getTitle());
        dialogb.setMessage(getMess());
        dialogb.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(acty.getApplication(), getCat(), Toast.LENGTH_SHORT).show();
            }
        });
        AlertDialog ald = dialogb.create();
        ald.show();
    }

    public void showAlertDialog(Context context, String title, String message, Boolean status) {
        AlertDialog alertDialog = new AlertDialog.Builder(context).create();

        // Setting Dialog Title
        alertDialog.setTitle(title);

        // Setting Dialog Message
        alertDialog.setMessage(message);

        // Setting alert dialog icon
        alertDialog.setIcon((status) ? R.drawable.success : R.drawable.fail);

        // Setting OK Button
        alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
            }
        });

        // Showing Alert Message
        alertDialog.show();
    }




}
